<?php
namespace Model;
use Kuyuan\WqCore\Model\Model;
use MongoDB\BSON\Timestamp;

/**
 * 万能表单数据
 * Class LinkModel
 * @package Model
 */
class FormModel extends Model
{
    protected $_fields = array(
        "id",
        "uniacid",
        "uid",
        "form_name",
        "form_data",
        "create_time",
        "status"
    );

    /**
     * 设置表单内容
     * @param $_value
     * @return false|string
     */
    public function setFormDataAttr($_value)
    {
        return json_encode($_value);
    }

    /**
     * 创建时间
     * @return mixed
     */
    public function setCreateTimeAttr()
    {
        return TIMESTAMP;
    }

    /**
     * 获取表单内容
     * @param $_value
     * @return mixed
     */
    public function getFormDataAttr($_value)
    {
        return json_decode($_value,true);
    }
}